
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>6.4 匹配原则 opProtocol · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="css/default.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="mobile.html" />
    
    
    <link rel="prev" href="rule-opv.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    1. xProxy 是什么？
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="good.html">
            
                <a href="good.html">
            
                    
                    1.1 xProxy 的优势
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="charles-diff.html">
            
                <a href="charles-diff.html">
            
                    
                    1.2 与 Charles 对比
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="INSTALL.html">
            
                <a href="INSTALL.html">
            
                    
                    2. xProxy 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    3. 面板说明
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="panel-main.html">
            
                <a href="panel-main.html">
            
                    
                    3.1 首页面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="panel-network.html">
            
                <a href="panel-network.html">
            
                    
                    3.2 Network 网络面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="panel-rule.html">
            
                <a href="panel-rule.html">
            
                    
                    3.3 Rules 规则面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="panel-value.html">
            
                <a href="panel-value.html">
            
                    
                    3.4 Values 值面板
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="start.html">
            
                <a href="start.html">
            
                    
                    4. 快速开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="frequent.html">
            
                <a href="frequent.html">
            
                    
                    4.1 常用功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="fit-recore.html">
            
                <a href="fit-recore.html">
            
                    
                    4.2 适配 Recore
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="fit-go.html">
            
                <a href="fit-go.html">
            
                    
                    4.3 适配乐高
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    5. 迁移
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="ihost.html">
            
                <a href="ihost.html">
            
                    
                    5.1 iHost 迁移
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="xswitch.html">
            
                <a href="xswitch.html">
            
                    
                    5.2 xSwitch 迁移
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="charles-m.html">
            
                <a href="charles-m.html">
            
                    
                    5.3 Charles 迁移
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    6. 规则
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="rule-model.html">
            
                <a href="rule-model.html">
            
                    
                    6.1 配置方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="rule-pattern.html">
            
                <a href="rule-pattern.html">
            
                    
                    6.2 匹配模式 pattern
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="rule-opv.html">
            
                <a href="rule-opv.html">
            
                    
                    6.3 操作值 opValue
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.4" data-path="rule-opp.html">
            
                <a href="rule-opp.html">
            
                    
                    6.4 匹配原则 opProtocol
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="mobile.html">
            
                <a href="mobile.html">
            
                    
                    7. 移动端接入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="qa.html">
            
                <a href="qa.html">
            
                    
                    8. 常见问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="th.html">
            
                <a href="th.html">
            
                    
                    致谢
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    反馈
            
                </span>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >6.4 匹配原则 opProtocol</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5339;&#x914D;&#x539F;&#x5219;-opprotocol">&#x5339;&#x914D;&#x539F;&#x5219; opProtocol</h1>
<p>&#x5E95;&#x5C42;&#x5E93;&#x7684;&#x534F;&#x8BAE;&#x6BD4;&#x8F83;&#x591A;&#xFF0C;&#x5177;&#x4F53;&#x53C2;&#x89C1;&#xFF1A;&#x534F;&#x8BAE;&#x5217;&#x8868;&#xFF0C;&#x8FD9;&#x4E9B;&#x534F;&#x8BAE;&#x7684;&#x5339;&#x914D;&#x4F18;&#x5148;&#x7EA7;&#x53CA;&#x540C;&#x65F6;&#x53EF;&#x5339;&#x914D;&#x89C4;&#x5219;&#x4E2A;&#x6570;&#x9075;&#x5FAA;&#x4EE5;&#x4E0B;&#x56DB;&#x4E2A;&#x539F;&#x5219;&#xFF1A;</p>
<ol>
<li>&#x76F8;&#x540C;&#x534F;&#x8BAE;&#x89C4;&#x5219;&#x7684;&#x9ED8;&#x8BA4;&#x4F18;&#x5148;&#x7EA7;&#x4ECE;&#x4E0A;&#x5230;&#x4E0B;&#xFF0C;&#x5373;&#x524D;&#x9762;&#x7684;&#x89C4;&#x5219;&#x4F18;&#x5148;&#x7EA7;&#x5339;&#x914D;&#x9AD8;&#x4E8E;&#x540E;&#x9762;&#xFF0C;&#x5982;&#xFF1A;</li>
</ol>
<pre><code> www.test.com 127.0.0.1:9999
 www.test.com/xxx 127.0.0.1:8080
</code></pre><p>&#x8BF7;&#x6C42; <code>https://www.test.com/xxx/index.html</code> &#x6309;&#x4ECE;&#x4E0A;&#x5230;&#x4E0B;&#x7684;&#x5339;&#x914D;&#x987A;&#x5E8F;&#xFF0C;&#x53EA;&#x4F1A;&#x5339;&#x914D; <code>www.test.com 127.0.0.1:9999</code>&#xFF0C;&#x8FD9;&#x4E2A;&#x4E0E;&#x4F20;&#x7EDF;&#x7684;hosts&#x914D;&#x7F6E;&#x540E;&#x9762;&#x4F18;&#x5148;&#x7684;&#x987A;&#x5E8F;&#x76F8;&#x53CD;&#x3002;</p>
<blockquote>
<p>&#x5982;&#x679C;&#x60F3;&#x8DDF;&#x7CFB;&#x7EDF;hosts&#x5339;&#x914D;&#x987A;&#x5E8F;&#x4E00;&#x81F4;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x754C;&#x9762;&#x901A;&#x8FC7; Rules -&gt; Settings -&gt; Back rules first &#x4FEE;&#x6539;&#xFF0C;&#x4F46;&#x8FD9;&#x4E2A;&#x89C4;&#x5219;&#x53EA;&#x5BF9;&#x5728;&#x9875;&#x9762;&#x91CC;&#x9762;&#x914D;&#x7F6E;&#x7684;&#x89C4;&#x5219;&#x751F;&#x6548;&#xFF0C;&#x5BF9;&#x63D2;&#x4EF6;&#x91CC;&#x9762;&#x81EA;&#x5E26;&#x7684;&#x89C4;&#x5219;&#x53CA;&#x901A;&#x8FC7;@&#x65B9;&#x5F0F;&#x5185;&#x8054;&#x7684;&#x8FDC;&#x7A0B;&#x89C4;&#x5219;&#x4E0D;&#x751F;&#x6548;&#x3002;</p>
</blockquote>
<ol>
<li>&#x9664;rule&#x53CA;proxy&#x5BF9;&#x5E94;&#x89C4;&#x5219;&#x9664;&#x5916;&#xFF0C;&#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x5339;&#x914D;&#x4E0D;&#x540C;&#x534F;&#x8BAE;&#x7684;&#x89C4;&#x5219;</li>
</ol>
<pre><code> www.test.com 127.0.0.1:9999
 www.test.com/xxx 127.0.0.1:8080
 www.test.com proxy://127.0.0.1:8888
 www.test.com/xxx socks://127.0.0.1:1080
 www.test.com pac://http://www.pac-server.com/test.pac
 www.test.com/xxx http://www.abc.com
 www.test.com file:///User/xxx/test
</code></pre><p>&#x8BF7;&#x6C42; <code>https://www.test.com/xxx/index.html</code> &#x6309;&#x4ECE;&#x4E0A;&#x5230;&#x4E0B;&#x7684;&#x5339;&#x914D;&#x987A;&#x5E8F;&#xFF0C;&#x53CA;&#x7B2C;&#x4E8C;&#x70B9;&#x539F;&#x5219;&#xFF0C;&#x4F1A;&#x5339;&#x914D;&#x4EE5;&#x4E0B;&#x89C4;&#x5219;&#xFF1A;</p>
<pre><code> www.test.com 127.0.0.1:9999
 www.test.com proxy://127.0.0.1:8888
 www.test.com pac://http://www.pac-server.com/test.pac
 www.test.com/xxx http://www.abc.com
</code></pre><blockquote>
<p>proxy&#x3001;http-proxy&#x3001;https-proxy&#x3001;socks&#x90FD;&#x5C5E;&#x4E8E;proxy&#xFF0C;html&#x3001;file&#x7B49;&#x90FD;&#x5C5E;&#x4E8E;rule&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x4E24;&#x4E2A;&#x5BF9;&#x5E94;&#x7684;&#x534F;&#x8BAE;&#x53EA;&#x80FD;&#x5404;&#x79CD;&#x5339;&#x914D;&#x5176;&#x4E2D;&#x4F18;&#x5148;&#x7EA7;&#x6700;&#x9AD8;&#x7684;&#x4E00;&#x4E2A;&#x3002;</p>
</blockquote>
<ol>
<li>&#x4E00;&#x4E9B;&#x5C5E;&#x4E8E;&#x4E0D;&#x540C;&#x534F;&#x8BAE;&#xFF0C;&#x4F46;&#x529F;&#x80FD;&#x6709;&#x51B2;&#x7A81;&#x7684;&#x89C4;&#x5219;&#xFF0C;&#x5982; <code>rule&#x3001;host&#x3001;proxy</code>&#xFF0C;&#x6309;&#x5E38;&#x7528;&#x4F18;&#x5148;&#x7EA7;&#x4E3A; <code>rule &gt; host &gt; proxy</code>&#xFF0C;&#x5982;&#xFF1A;</li>
</ol>
<pre><code> www.test.com 127.0.0.1:9999
 www.test.com/xxx 127.0.0.1:8080
 www.test.com proxy://127.0.0.1:8888
 www.test.com/xxx socks://127.0.0.1:1080
 www.test.com file:///User/xxx/test
 www.test.com/xxx http://www.abc.com
</code></pre><p>&#x4E0A;&#x8FF0;&#x540C;&#x65F6;&#x5339;&#x914D;file&#x3001;host&#x3001;proxy&#xFF0C;&#x4F46;&#x53EA;&#x4F1A;&#x6267;&#x884C;&#x672C;&#x5730;&#x66FF;&#x6362;file&#x3002;</p>
<ol>
<li>&#x90E8;&#x5206;&#x76F8;&#x540C;&#x534F;&#x8BAE;&#x4F1A;&#x5339;&#x914D;&#x53CA;&#x5408;&#x5E76;&#x6240;&#x6709;&#x53EF;&#x4EE5;&#x5339;&#x914D;&#x7684;&#x89C4;&#x5219;&#xFF0C;&#x5982;&#xFF1A;</li>
</ol>
<pre><code> www.test.com 127.0.0.1:9999
 www.test.com/xxx 127.0.0.1:8080
 www.test.com proxy://127.0.0.1:8888
 www.test.com/xxx socks://127.0.0.1:1080
 www.test.com pac://http://www.pac-server.com/test.pac
 www.test.com/xxx http://www.abc.com
 www.test.com file:///User/xxx/test
 www.test.com/xxx reqHeaders://{test.json}
 www.test.com reqHeaders:///User/xxx/test.json
 www.test.com/xxx htmlAppend:///User/xxx/test.html
 www.test.com htmlAppend://{test.html}
 www.test.com/xxx reqHeaders:///User/xxx/test2.json
 www.test.com htmlAppend://{test2.html}
</code></pre><p>&#x8BF7;&#x6C42; <code>https://www.test.com/xxx/index.html</code> &#x4F1A;&#x5339;&#x914D;&#x4EE5;&#x4E0B;&#x89C4;&#x5219;&#xFF1A;</p>
<pre><code> www.test.com 127.0.0.1:9999
 www.test.com proxy://127.0.0.1:8888
 www.test.com pac://http://www.pac-server.com/test.pac
 www.test.com/xxx http://www.abc.com
 www.test.com/xxx reqHeaders://{test.json}
 www.test.com reqHeaders:///User/xxx/test.json
 www.test.com/xxx htmlAppend:///User/xxx/test.html
 www.test.com htmlAppend://{test.html}
 www.test.com/xxx reqHeaders:///User/xxx/test2.json
 www.test.com htmlAppend://{test2.html}
</code></pre><p>&#x5176;&#x4E2D;&#xFF0C;&#x6240;&#x6709;&#x5339;&#x914D;&#x7684;reqHeaders&#x534F;&#x8BAE;&#x7684;&#x89C4;&#x5219;&#x4F1A;&#x5C06;&#x5176;&#x5BF9;&#x5E94;&#x7684;json&#x5408;&#x5E76;&#x540E;&#x518D;&#x5408;&#x5E76;&#x5230;&#x8BF7;&#x6C42;headers&#x91CC;&#xFF0C;&#x800C;&#x6240;&#x6709;&#x5339;&#x914D;htmlAppend&#x7684;html&#x5185;&#x5BB9;&#x4F1A;&#x901A;&#x8FC7;&#x6362;&#x884C;&#x7B26; \n &#x5408;&#x5E76;&#x5E76;&#x8FFD;&#x52A0;&#x5230;&#x54CD;&#x5E94;&#x7684;html&#x5185;&#x5BB9;&#x91CC;&#x9762;&#xFF0C;&#x5176;&#x5B83;&#x53EF;&#x4EE5;&#x5408;&#x5E76;&#x7684;&#x534F;&#x8BAE;&#x5982;&#x4E0B;&#xFF08;&#x4E3B;&#x8981;&#x6D89;&#x53CA;json&#x3001;&#x6CE8;&#x5165;&#x5185;&#x5BB9;&#x3001;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x5BF9;&#x5E94;&#x7684;&#x534F;&#x8BAE;&#xFF09;&#xFF1A;</p>
<ul>
<li>ignore</li>
<li>enable</li>
<li>filter</li>
<li>disable</li>
<li>plugin</li>
<li>delete</li>
<li>urlParams</li>
<li>params</li>
<li>reqHeaders</li>
<li>resHeaders</li>
<li>reqCors</li>
<li>resCors</li>
<li>reqCookies</li>
<li>resCookies</li>
<li>reqReplace</li>
<li>urlReplace</li>
<li>resReplace</li>
<li>resMerge</li>
<li>reqBody</li>
<li>reqPrepend</li>
<li>resPrepend</li>
<li>reqAppend</li>
<li>resAppend</li>
<li>resBody</li>
<li>htmlAppend</li>
<li>jsAppend</li>
<li>cssAppend</li>
<li>htmlBody</li>
<li>jsBody</li>
<li>cssBody</li>
<li>htmlPrepend</li>
<li>jsPrepend</li>
<li>cssPrepend</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="rule-opv.html" class="navigation navigation-prev " aria-label="Previous page: 6.3 操作值 opValue">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="mobile.html" class="navigation navigation-next " aria-label="Next page: 7. 移动端接入">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"6.4 匹配原则 opProtocol","level":"1.6.4","depth":2,"next":{"title":"7. 移动端接入","level":"1.7","depth":1,"path":"mobile.md","ref":"mobile.md","articles":[]},"previous":{"title":"6.3 操作值 opValue","level":"1.6.3","depth":2,"path":"rule-opv.md","ref":"rule-opv.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"css/default.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"language":"zh-hans","gitbook":"*"},"file":{"path":"rule-opp.md","mtime":"2019-11-05T10:46:37.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-17T11:59:46.789Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

